﻿using System.IO;

namespace Sex
{
    public partial class Sex : System.Web.UI.Page
    {
        public class ListThumbs : MyList
        {
            public ListThumbs(State MyState, string CurrentPathRel) : base(MyState)
            {
                DirectoryInfo di = new DirectoryInfo(MyState.CurrentPathAbs);
                FileInfo[] fi = di.GetFiles();
                /*
                if ((MyState.CurrentPathRel == "") || (MyState.CurrentPathRel == "/"))
                {
                }
                else
                {
                    if (!MyState.CurrentPathRel.EndsWith("/")) MyState.CurrentPathRel += "/";
                }
                */
                if (!CurrentPathRel.EndsWith("/")) CurrentPathRel += "/";
                for (int i = 0; i < fi.Length; i++)
                {
                    string Extension = Path.GetExtension(fi[i].Extension);
                    string Name = fi[i].Name;
                    string FullName = fi[i].FullName;
                    E_ObjectCommand ft = FileTypes.GetFileTypeInThumb(Extension);
                    FileGroup.Type fg = FileTypes.GetFileType(Extension);
                    Add(FullName, new string[] { CurrentPathRel + Name, ((int)ft).ToString(), ((int)fg).ToString() });
                }
            }
        }
    }
}